import gdata.docs.data
import gdata.docs.client
import gdata.spreadsheet.service
import sys, os
from optparse import OptionParser

p = OptionParser()
p.add_option('-u', dest='user', help="Gmail account name")
p.add_option('-p', dest='password', help="Gmail password")
(opt, args) = p.parse_args()

if not (opt.user and opt.password):
  p.print_help()
  sys.exit(0)

cdoc = gdata.docs.client.DocsClient()
cdoc.ssl = True
cdoc.ClientLogin(email=opt.user, password=opt.password, source='uoit-pages')

# Get the folder
for f in cdoc.GetDocList(uri="/feeds/default/private/full/-/folder").entry:
  if f.title.text.startswith("pages -"):
    print f.title.text
